<template>
	<div class="index">

    <div style="position: fixed; left: 0; bottom: 0; width:100vw; font-size: 14px; background: #fff; z-index: 999; border-radius: 0.2rem 0.2rem 0 0; ">
      <!-- <div class="flex" v-if="tab" >
        <div style="flex: 1; height: 1rem;" class="flexcc">
          <div @click="goshangcheng('/index')">
            <div class="flexcc"  :class="act == 1?'navtitleact':'navtitle'"><img src="../../../static/img/jiameng0.svg" style="width: 0.3rem; margin-bottom: 0.05rem;"></div>
            <div :class="act == 1?'lan':'hui'">商城</div>
          </div>
        </div>

        <div style="flex: 1; height: 1rem;" class="flexcc">
          <div @click="gohoutai">
            <div  class="flexcc"  :class="act == 2?'navtitleact':'navtitle'"><img src="../../../static/img/jiameng1.svg" style="width: 0.3rem; margin-bottom: 0.05rem;"></div>
            <div :class="act == 2?'lan':'hui'">我的</div>
          </div>
        </div>
      </div> -->
       <div class="tabs_container">
           <div class="tabs_item" @click="homeClick" :class="act == 1?'navtitle':'navtitleact'">
            <img src="../../../static/img/n1.svg" alt=""/>
            <div>首页</div>
           </div>
           <div class="tabs_item" @click="orderClick">
            <img src="../../../static/img/n2.svg" alt=""/>
            <div>订单</div>
           </div>
           <div class="tabs_item" @click="waresClick">
            <img src="../../../static/img/n3.svg" alt=""/>
            <div>商品</div>
           </div>
           <div class="tabs_item" @click="retailClick">
            <img src="../../../static/img/n4.svg" alt=""/>
            <div>分销商</div>
           </div>
           <div class="tabs_item" @click="mineClick">
            <img src="../../../static/img/n5.svg" alt=""/>
            <div>我的</div>
           </div>
       </div>
    </div>

	</div>
</template>

<script>
  var h = document.documentElement.clientWidth / 7.5 + 'px';
  document.documentElement.style.fontSize = h;
	export default {
		name: 'footers',
		data() {
			return {
        all:"",
        act:2,
     // tab:false
			}
		},
		created() {

		},
		mounted() {
      if(location.pathname.includes('index')){
        this.act = 1
      }
		},
		methods: {
      homeClick:function(){
        window.location.href = location.origin + '/web/index'
      },
      orderClick:function(){
        window.location.href = location.origin + '/web/dingdanguanli/dingdanchuli'
      },
      waresClick:function(){
        window.location.href = location.origin + '/web/shangpinguanli/zaishoushangpin'
      },
      retailClick:function(){
        window.location.href = location.origin + '/web/fenxiaoshangguanli/fenxiaoshangguanli'
      },
      mineClick:function(){
        window.location.href = location.origin + '/web/geren/geren'
      },

      goshangcheng:function(){
        axios.get('/agent/auth/user').then((response)=>{
        	if (response.data.msg.code == 0) {
            let url = location.origin + '/h5'
            location.href = location.origin + '/h5?shop_id=' + window.btoa(response.data.data.id)
    
        	}else {
            vant.Toast(response.data.msg.info);
            this.$router.push({
              path:'/jiameng'
            })
        	}
        })
      },
      gohoutai:function(){
        axios.get('/agent/auth/user').then((response)=>{
        	if (response.data.msg.code == 0) {
            window.location.href = location.origin + '/web/index?open=1'
            //  location.href = `${location.origin}/web/`;
        	}else {
            vant.Toast(response.data.msg.info);
            this.$router.push({
              path:'/jiameng'
            })
        	}
        })
      }

		},
    watch:{
      $route:{
        handler:function(to, from) {
        console.log('to',to)
        if(to.fullPath.includes('tab')){
          this.tab = true
        }
      },
      immediate: true,
      deep: true
      }
    }
	}
</script>


<style scoped lang="less">
  .index{
    .navtitleact{
      img{
        filter: drop-shadow(rgb(175, 179, 188) 10000px 0);
        transform: translateX(-10000px);
        position: relative;
        top: -1px;
      }
    }
    .navtitle{
      color:#005aff;
      img{
        filter: drop-shadow(rgb(0, 90, 255) 10000px 0);
        transform: translateX(-10000px);
        position: relative;
        top: -1px;
      }
    }

    .lan{ color: rgb(0, 90, 255);}
    .hui{color: rgb(175, 179, 188);}
  }
  .tabs_container{
    width: 100%;
    height: 1rem;
    display: flex;
    justify-content: space-around;
    font-size: 0.2rem;
    background: #fff;
    color: #666;
    img{
      width: 0.5rem;
      margin-bottom: 0.1rem;
    }
    .tabs_item{
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
  }
</style>
